<template>
  <div
    class="diy-order"
    :style="[
      `padding:${diyItem.style.mt}px ${diyItem.style.mr}px ${diyItem.style.mb}px ${diyItem.style.ml}px `,
    ]"
  >
    <div
      class="diy-order-list"
      :class="diyItem.style.shade == 1 ? 'style-shade' : ''"
      :style="[
        `padding:${diyItem.style.pt}px ${diyItem.style.pr}px ${diyItem.style.pb}px ${diyItem.style.pl}px `,
        `background:${
          diyItem.style.bg_status == 1 ? diyItem.style.bg : 'none'
        }`,
        `border-radius:${diyItem.style.t_radius}px ${diyItem.style.t_radius}px ${diyItem.style.b_radius}px ${diyItem.style.b_radius}px`,
      ]"
    >
      <template v-for="(item, idx) in diyItem.data" :key="idx">
        <div class="diy-order-item">
          <div class="diy-order-item-block">
            <img :src="item.icon" />
            <div
              class="text"
              :style="{ color: item.style.color }"
              :class="item.style.fw == 1 ? 'fw' : ''"
            >
              {{ item.title }}
            </div>
          </div>
        </div>
      </template>
    </div>
  </div>
</template>
<script lang="ts">
export default {
  name: "storeDiyPreviewOrder",
};
</script>
<script  lang="ts" setup >
import { ref, getCurrentInstance } from "vue";
import { diyOrderDataType } from "@/types";

const props = withDefaults(
  defineProps<{
    diyItem: diyOrderDataType;
    index: number | string;
  }>(),
  {
    diyItem: () => {
      return {
        style: {
          bg_status: 1,
          bg: "",
          shade: 0,
          mt: 0,
          mb: 0,
          ml: 0,
          mr: 0,
          pt: 0,
          pb: 0,
          pl: 0,
          pr: 0,
          t_radius: 0,
          b_radius: 0,
        },
        data: [],
      };
    },
    index: 0,
  }
);
</script>

<style scoped>
.diy-order-list{
    display: flex;
    justify-content: space-around;
    align-items: center;
    text-align: center;
}
.diy-order-item{
    width: 20%;
}
.diy-order-item img{
    width: 28px;
    height: 28px;
}
</style>
